#include <stdio.h>
#include "mvos/mvos_apis.h"
#include "test_apis.h"

static mv_bool_t md_draw_box = MV_FALSE;
static mv_bool_t hd_draw_box = MV_TRUE;

mv_s32_t test_alarm_wait_data(mv_bool_t draw_box)
{
    MVP_ALARM_DATA_T _st_data;
    memset(&_st_data, 0, sizeof(MVP_ALARM_DATA_T));

    mvp_alarm_wait_trigger(&_st_data, 1000);
    if(_st_data.data.image_data.s32_obj_num > 0) {
        if(md_draw_box && _st_data.type == ALARM_MOVE_DET) {
            mvp_alarm_draw_box(&_st_data);
        } else if(hd_draw_box && _st_data.type == ALARM_HUMAN_DET) {
            mvp_alarm_draw_box(&_st_data);
        }
    }

    return MV_EC_SUCCESS;
}

mv_s32_t test_alarm_md_start()
{
    MVP_ALARM_INFO_T _st_md;
	_st_md.bl_push_data    = MV_TRUE;
    _st_md.type            = ALARM_MOVE_DET;
	_st_md.s32_sensitivity = 80;
	mvp_alarm_start(&_st_md);
    return MV_EC_SUCCESS;
}

mv_s32_t test_alarm_md_stop ()
{
    mvp_alarm_stop(ALARM_MOVE_DET);
    return MV_EC_SUCCESS;
}

mv_s32_t test_alarm_hd_start()
{
    MVP_ALARM_INFO_T _st_hd;
	_st_hd.bl_push_data    = MV_TRUE;
    _st_hd.type            = ALARM_HUMAN_DET;
	_st_hd.s32_sensitivity = 80;
	mvp_alarm_start(&_st_hd);
    return MV_EC_SUCCESS;
}

mv_s32_t test_alarm_hd_stop ()
{
    mvp_alarm_stop(ALARM_HUMAN_DET);
    return MV_EC_SUCCESS;
}